package com.yst.suivi.data.team;

import java.rmi.RemoteException;

import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;

import com.yst.suivi.data.AbstractEntityBean;
import com.yst.suivi.data.rights.Profil;

/**
 * @author stolf
 * @ejb.bean name="TeamRole" type="CMP" cmp-version="2.x" schema="teamRole"
 *           local-jndi-name="TeamRoleBean" view-type="local" primkey-field = "id"
 *           reentrant = "True"
 * @ejb.home generate="local"
 * @ejb.persistence table-name = "teamRole"
 * @jboss.entity-command name = "key-generator"
 * @jboss.read-ahead eager-load-group = "most" strategy = "on-load"
 *                   page-size="25"
 * @jboss.load-group name="most"
 * @ejb.interface local-extends = "com.yst.suivi.data.util.NamedObject,
 *                javax.ejb.EJBLocalObject"
 * @ejb.finder signature="java.util.Collection findAll()" query="SELECT
 *             OBJECT(g) FROM teamRole AS g"
 * 
 */
public abstract class TeamRoleBean extends AbstractEntityBean implements EntityBean
{

	/**
	 * @return
	 * @throws CreateException
	 * @ejb.create-method view-type = "local"
	 */
	public String ejbCreate() throws CreateException
	{
		return null;
	}

	public void ejbPostCreate()
	{
		// by default nothing to do
	}

	/**
	 * Return the primary key of the object
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getId();

	/**
	 * Fix the primary key of the object. The method should be used only by the
	 * container
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setId(String id);

	/**
	 * Return the name of the object
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getNom();

	/**
	 * Fix the name of the user. The method should be used only by the container
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setNom(String nom);

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.yst.suivi.data.AbstractEntityBean#ejbLoad()
	 */
	public void ejbLoad() throws EJBException, RemoteException
	{
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.yst.suivi.data.AbstractEntityBean#ejbPassivate()
	 */
	public void ejbPassivate() throws EJBException, RemoteException
	{
	}

	/**
	 * Retourne la liste des utilisateurs affectes au team
	 * 
	 * @return Collection
	 * @ejb.interface-method view-type = "local"
	 * @ejb.relation name="teamRole-profil" role-name = "TeamRoleProfilRole"
	 *               target-role-name = "ProfilTeamRoleRole" target-multiple = "yes"
	 *               target-ejb="Profil"
	 * @jboss.relation related-pk-field = "id" fk-constraint = "true" fk-column =
	 *                 "profilId"
	 * @ejb.interface-method view-type = "local"
	 * @return Collection
	 */
	public abstract Profil getProfil();

	/**
	 * Positionne la liste de tous les profils qui apaprtiennent au team. La
	 * collection doit contenir des objets User.
	 * 
	 * @param plf
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setProfil(Profil profils);
}
